

%\usepackage{color}
\usepackage[dvipsnames]{xcolor}
\usepackage{colortbl}
\usepackage{mathrsfs,amsmath,amssymb,amsthm}
\usepackage[all]{xy}
\usepackage[utf8]{inputenc}
\usepackage{environ}
%\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{url}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning}
\usepackage{tkz-tab}
\usepackage[colorlinks,linkcolor=blue]{hyperref}
\usepackage[tikz]{bclogo}
\usepackage{array}
\usepackage{tabularx}
\usepackage{fancyhdr}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{pstricks,pst-plot,pst-tree,pstricks-add}
\usepackage{graphicx}
\usepackage{cancel}
\usepackage{listings}
\usepackage{blkarray}
\usepackage{pst-blur}
\usepackage{stmaryrd}
\usepackage{eso-pic}
\usepackage{transparent}
\usepackage{enumitem}
\usepackage{etoolbox}
\usepackage{systeme}


\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}

\lstdefinestyle{mypythonstyle}{
    backgroundcolor=\color{black},   
    commentstyle=\itshape\color{ForestGreen},
    keywordstyle=\color{Aquamarine},
    numberstyle=\tiny\color{codegray},
    stringstyle=\color{Thistle},
    basicstyle=\ttfamily\footnotesize\color{white},
    frame=single
    breakatwhitespace=false,         
    breaklines=true,                 
    captionpos=b,                    
    keepspaces=true,                 
    numbers=left,                    
    numbersep=5pt,                  
    showspaces=false,                
    showstringspaces=false,
    showtabs=false,                  
    tabsize=2,
    deletekeywords={range},
    morekeywords={def, import, as, return, for, while, in, if, else, elif},
    language=python
}



\lstdefinestyle{mysqlstyle}{
    backgroundcolor=\color{black},
%    frame=single,
%    framerule=0pt,  
    commentstyle=\color{codegreen},
    keywordstyle=\color{Magenta},
    deletekeywords={INTEGER, DATE, TEXT},
    numberstyle=\tiny\color{codegray},
    stringstyle=\color{GreenYellow},
    basicstyle=\footnotesize\ttfamily\color{white},
	emph={INTEGER , DATE , TEXT, count, max, mean, avg},
    emphstyle={\color{SkyBlue}},
    breakatwhitespace=false,
    breaklines=true,
    captionpos=b,
    keepspaces=false,
    numbers=left,
    numbersep=10pt,
    showspaces=false,
    showstringspaces=false,
    showtabs=false,
    language=SQL
}





\lstset{style=mypythonstyle}
%\lstset{style=mysqlstyle}




 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% En-têtes et pieds de page %%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\ptbox{\framebox[1.2cm]{\rule[-.2cm]{0cm}{.8cm}}}
\def\ntbox{\framebox[2.4cm]{\rule[-.8cm]{0cm}{2cm}}}




 %%%%%%%%%%%
%%% Marges %%%
 %%%%%%%%%%%

\usepackage[top=2cm,bottom=4cm,left=1.5cm,right=1.5cm]{geometry}




 %%%%%%%%%%%%%%
%%% Exercices %%%
 %%%%%%%%%%%%%%%
 
\newcommand{\encad}[1]{\fbox{\begin{minipage}[t]{0.75\linewidth}#1\end{minipage}}}

\renewcommand{\labelenumi}{%
\textbf{\theenumi.}}
\renewcommand{\labelenumii}{%
\textbf{\theenumii.}}


\renewcommand{\FrenchLabelItem}{\textbullet}


%\newtheorem{Exc}{EXERCICE}
%\Newassociation{correction}{Soln}{mycor}
%\renewcommand{\Solnlabel}[1]{CORRIGÉ #1}
%\def\exo#1{%
%\futurelet\testchar\MaybeOptArgmyexoo}
%\def\MaybeOptArgmyexoo{
%\ifx[\testchar \let\next\OptArgmyexoo
%\else \let\next\NoOptArgmyexoo \fi \next}
%\def\OptArgmyexoo[#1]{%
%\begin{Exc}[#1]\normalfont}
%\def\NoOptArgmyexoo{%
%\begin{Exc}\normalfont}
%\newcommand{\finexo}{\end{Exc}}
%\newcommand{\flag}[1]{}
%\newif\ifprof
%\newcommand{\entete}[1]



 %%%%%%%%%%%%%%%%%%%%%%%
%%% Commandes diverses %%%
 %%%%%%%%%%%%%%%%%%%%%%%
 
 
 
 


\def\note#1{\textcolor{red}{#1} }
 
 
 

\newcommand{\eps}{\varepsilon}
\newcommand{\To}{\longrightarrow}

\newcommand{\pa}{\partial}
\newcommand{\ds}{\displaystyle}
\newcommand{\ol}{\overline}


\newcommand{\Diff}{\operatorname{Diff}} 
\newcommand{\Vol}{\operatorname{Vol}} 
\newcommand{\Isom}{\operatorname{Isom}} 
\newcommand{\SphereVol}{\operatorname{SphereVol}}
\newcommand{\masse}{\operatorname{masse}}
\newcommand{\comasse}{\operatorname{comasse}}
\newcommand{\ent}{\operatorname{ent}}
\newcommand{\trace}{\operatorname{trace}}
\newcommand{\sys}{\operatorname{sys}}
\newcommand{\MinVol}{\operatorname{MinVol}}
\newcommand{\aire}{\operatorname{Aire}}
\newcommand{\scal}{\operatorname{scal}}
\newcommand{\Ric}{\operatorname{Ric}}
\newcommand{\Ke}{\operatorname{K}}
\newcommand{\Jac}{\operatorname{Jac}}
\newcommand{\can}{\operatorname{can}}
\newcommand{\Stab}{\operatorname{Stab}}




\newcommand{\fonction}[5]{\begin{array}{cccl}          
#1: & #2 & \longrightarrow & #3 \\
    & #4 & \longmapsto & #5 \end{array}}
 

 
\newcommand{\norm}[1]{\left\Vert#1\right\Vert}
\newcommand{\abs}[1]{\left\vert#1\right\vert}
\newcommand{\set}[1]{\left\{#1\right\}}
\newcommand{\crochet}[1]{\left[#1\right]}


 %%%%%%%%%%%%%%%%
%%%  Lettrage  %%%
 %%%%%%%%%%%%%%%%



\newcommand{\A}{{\mathbb A}}
\newcommand{\B}{{\mathbb B}}
\newcommand{\C}{{\mathbb C}}
\newcommand{\D}{{\mathbb D}}
\newcommand{\F}{{\mathbb F}}
\newcommand{\K}{{\mathbb K}}
\newcommand{\I}{{\mathbb I}}
\newcommand{\N}{{\mathbb N}}
\newcommand{\Q}{{\mathbb Q}}
\newcommand{\R}{\mathbb R}
\newcommand{\Z}{\mathbb{Z}}

\newcommand{\Aac}{\mathcal A}
\newcommand\Bbc{\mathcal B}
\newcommand\Ccc{\mathcal C}
\newcommand\Ddc{\mathcal D}
\newcommand\Eec{\mathcal E}
\newcommand\Ffc{\mathcal F}
\newcommand\Ggc{\mathcal G}
\newcommand\Hhc{\mathcal H}
\newcommand\Llc{\mathcal L}
\newcommand{\Mmc}{\mathcal M}
\newcommand\Nnc{\mathcal N}
\newcommand\Ppc{\mathcal P}
\newcommand\Qqc{\mathcal Q}
\newcommand\Ssc{\mathcal S}
\newcommand\Uuc{\mathcal U}

\newcommand{\cala}{\calligra{A}}
\newcommand{\cald}{\calligra{D}}
\newcommand{\calh}{\calligra{H}}

\newcommand{\ind}{\mathds{1}}


\newcommand{\aA}{\mathfrak{A}}
\newcommand{\dD}{\mathfrak{D}}
\newcommand{\mM}{\mathfrak{M}}
\newcommand{\sS}{\mathfrak{S}}







 %%%%%%%%%%%%%%
%%%  Suites  %%%
 %%%%%%%%%%%%%%



\newcommand\an{(a_n)_{n\in\N}}
\newcommand\bn{(b_n)_{n\in\N}}
\newcommand\un{(u_n)_{n\in\N}}
\newcommand\vn{(v_n)_{n\in\N}}
\newcommand\wn{(w_n)_{n\in\N}}
\newcommand\xn{(x_n)_{n\in\N}}
\newcommand\suite[3]{(#1_#2)_{#2\in #3}}





 %%%%%%%%%%%%%%%
%%%  Analyse  %%%
 %%%%%%%%%%%%%%%


\newcommand\dsim{\mathop{\sim}\limits}
\newcommand{\petito}[2]{\mathop{\bf{o}}\limits_{#1}\left(#2\right)}
\newcommand{\grandO}[1]{O\mathopen{}\left(#1\right)}
\newcommand\dlim{\lim\limits} %% Met $n\to\infty$ en dessous.
\newcommand\dsum{\sum\limits} %% Pareil
\newcommand\dint{\displaystyle\int}





 %%%%%%%%%%%%%%%%%%%%%%%
%%%  Algèbre linéaire  %%%
 %%%%%%%%%%%%%%%%%%%%%%%

\newcommand\vect{\mathrm{Vect}}
\newcommand{\matdeux}[4]{\begin{pmatrix} #1&#2\\#3&#4\end{pmatrix}}
\newcommand{\mattrois}[9]{\begin{pmatrix} #1&#2&#3\\#4&#5&#6\\#7&#8&#9\end{pmatrix}}
\newcommand{\matunn}[3]{\begin{pmatrix} #1\\#2\\ \vdots \\#3\end{pmatrix}}
\newcommand{\matuntrois}[3]{\begin{pmatrix} #1\\#2\\#3\end{pmatrix}}
\newcommand{\matunquatre}[4]{\begin{pmatrix} #1\\#2\\#3 \\#4\end{pmatrix}}
\newcommand{\matundeux}[2]{\begin{pmatrix} #1\\#2\end{pmatrix}}
\newcommand\mat{\mathrm{Mat}}


\newcommand\rg{\textrm{rg}}
\newcommand\im{\textrm{Im}}
\renewcommand\ker{\textrm{Ker}}
\newcommand\id{\textrm{Id}}
\newcommand\spe{\mathrm{Sp}}




 %%%%%%%%%%%%%%
%%%  Probas  %%%
 %%%%%%%%%%%%%%

\newcommand\cov{\mathrm{Cov}}
\newcommand\card{\textrm{Card}}



 %%%%%%%%%%%%%%
%%% Théorèmes %%%
 %%%%%%%%%%%%%%%



\theoremstyle{definition}
\newtheorem{thm}{Théorème}
\newtheorem{cor}{Corollaire}[thm]
\newtheorem{lem}[thm]{Lemme}
\newtheorem{prop}[thm]{Proposition}


\theoremstyle{remark}
\newtheorem{rmq}[thm]{Remarque}

\newtheorem{defi}[thm]{Définition}
\newtheorem{exemple}[thm]{Exemple}
\newtheorem{prob}[thm]{Problème}
\newtheorem{methode}[thm]{Méthode}


\newtheoremstyle{exo}%
{\topsep}% espace avant
{\topsep}% espace après
{\upshape}% police du corps du théorème
{}% indentation (vide pour rien, \parindent)
{\bfseries}% police du titre du théorème
{}% ponctuation après le théorème
{\newline }% espace après le titre du théorème (\newline = saut de ligne)
{\thmname{#1}\thmnumber{ \textup{#2}}.- \thmnote{ \textnormal{\itshape#3.}}}% spécification
% du titre du théorème
\theoremstyle{exo}
\newtheorem{exo}{Exercice}
\newtheorem{correction}{Correction}

\newtheorem{innercustomthm}{Correction}
\newenvironment{customcorrection}[1]
  {\renewcommand\theinnercustomthm{#1}\innercustomthm}
  {\endinnercustomthm}

 %%%%%%%%%%%%%%%%%%%%%%
%%%  Environnements  %%%
 %%%%%%%%%%%%%%%%%%%%%%
 
 

\newenvironment{demo}{\begin{quote}\parindent=0mm \footnotesize \textit{Démonstration}. }{\qed\end{quote}}







\newenvironment{propenvi}[1]{
\begin{bclogo}[logo=\empty, ombre = true, arrondi=0.2, epOmbre = 0.25, couleurOmbre = black!30, couleur = BlueGreen!10,couleurBarre=BlueGreen!70]{Proposition : #1}
}
{
\end{bclogo}
\smallskip
}


\newenvironment{corenvi}[1]{
\begin{bclogo}[logo=\empty, ombre = true, arrondi=0.2, epOmbre = 0.25, couleurOmbre = black!30, couleur = BlueGreen!10,couleurBarre=BlueGreen!70]{Corollaire : #1}
}
{
\end{bclogo}
\smallskip
}


\newenvironment{defienvi}[1]{
\begin{bclogo}[logo=\empty, couleurBarre=Apricot!80, , arrondi=0.2, couleur = Apricot!10, ombre = true, epOmbre = 0.25, couleurOmbre = black!30]{Définition : #1}
%\begin{defi}
}
{
%\end{defi}
\end{bclogo}
\smallskip
}


\newenvironment{methodeenvi}[1]{
\begin{bclogo}[logo=\empty, couleurBarre=GreenYellow!70!black, arrondi=0.2, couleur = GreenYellow!10, ombre = true, epOmbre = 0.25, couleurOmbre = black!30]{Méthode~: #1}
}
{
\end{bclogo}
\smallskip
}




\newenvironment{thmenvi}[1]{
\begin{bclogo}[logo=\empty, ombre = true, arrondi =0.2, epOmbre = 0.25, couleurOmbre = black!30, couleur = BlueGreen!10,couleurBarre=BlueGreen!70]{Théorème : #1}
}
{
\end{bclogo}
\smallskip
}



\newenvironment{python}[1]{
\begin{bclogo}[logo=\empty, ombre = true, arrondi =0.2, epOmbre = 0.25, couleurOmbre = black!30, couleur = Salmon!10,couleurBarre=Salmon!10]{#1}
}
{
\end{bclogo}


\smallskip
}





%    \NewEnviron{thmenvi}[1]{%
  % Define box and box title style
%  \tikzstyle{mybox} = [draw=black!50, very thick, rectangle, rounded
%  corners, inner sep=10pt, inner ysep=8pt] %
%  \tikzstyle{fancytitle} =[rounded corners, fill=BlueGreen,
%  text=black] %
%  \tikzstyle{fancylogo} =[ text=white]
%  \begin{center}
%    \begin{tikzpicture}
%      \node [mybox] (box){%
%        \begin{minipage}{0.9\linewidth}
%          \vspace{6pt}
%          %\begin{thm}
%           \BODY
%          %\end{thm}
%        \end{minipage}
%      }; %
%      \node[fancytitle, right=10pt] at (box.north west) %
%      {\bfseries\normalsize{Théorème : #1}}; %
%    \end{tikzpicture}%
%  \end{center}
%}

%    \NewEnviron{methodeenvi}[1]{
%  \tikzstyle{mybox} = [draw=black!50, very thick, rectangle, rounded
%  corners, inner sep=10pt, inner ysep=8pt]
%  \tikzstyle{fancytitle} =[rounded corners, fill=GreenYellow,
%  text=black]
%  \tikzstyle{fancylogo} =[ text=white]
%  \begin{center}
%    \begin{tikzpicture}
%      \node [mybox] (box){
%        \begin{minipage}{0.9\linewidth}
%          \vspace{6pt} \BODY
%        \end{minipage}
%      };
%      \node[fancytitle, right=10pt] at (box.north west) 
%      {\bfseries\normalsize{Méthode : #1}}; 
%    \end{tikzpicture}
%    
%  \end{center}
%}

%\NewEnviron{defienvi}[1]{%
%\tikzstyle{mybox} = [draw=black!50, very thick, rectangle, rounded
%  corners, inner sep=10pt, inner ysep=8pt] %
%  \tikzstyle{fancytitle} =[rounded corners, fill=Apricot,
%  text=black] %
%  \tikzstyle{fancylogo} =[ text=white]
%  \begin{center}
%    \begin{tikzpicture}
%      \node [mybox] (box){%
%        \begin{minipage}{0.9\linewidth}
%          \vspace{6pt} \BODY
%   \end{minipage}
%      }; %
%      \node[fancytitle, right=10pt] at (box.north west) %
%      {\bfseries\normalsize{D\'efinition : #1}}; %
%    \end{tikzpicture}%
%  \end{center}
%}


%    \NewEnviron{propenvi}[1]{%
  % Define box and box title style
%  \tikzstyle{mybox} = [draw=black!50, very thick, rectangle, rounded
%  corners, inner sep=10pt, inner ysep=8pt] %
%  \tikzstyle{fancytitle} =[rounded corners, fill=BlueGreen,
%  text=black] %
%  \tikzstyle{fancylogo} =[ text=white]
%  \begin{center}
%    \begin{tikzpicture}
%      \node [mybox] (box){%
%        \begin{minipage}{0.9\linewidth}
%          \vspace{6pt}
%          %\begin{thm}
%           \BODY
%          %\end{thm}
%        \end{minipage}
%      }; %
%      \node[fancytitle, right=10pt] at (box.north west) %
%      {\bfseries\normalsize{Proposition : #1}}; %
%    \end{tikzpicture}%
%  \end{center}
%}


%    \NewEnviron{corenvi}[1]{%
  % Define box and box title style
%  \tikzstyle{mybox} = [draw=black!50, very thick, rectangle, rounded
%  corners, inner sep=10pt, inner ysep=8pt] %
%  \tikzstyle{fancytitle} =[rounded corners, fill=BlueGreen,
%  text=black] %
%  \tikzstyle{fancylogo} =[ text=white]
%  \begin{center}
%    \begin{tikzpicture}
%      \node [mybox] (box){%
%        \begin{minipage}{0.9\linewidth}
%          \vspace{6pt}
          %\begin{thm}
%           \BODY
          %\end{thm}
%        \end{minipage}
%      }; %
%      \node[fancytitle, right=10pt] at (box.north west) %
%      {\bfseries\normalsize{Corollaire : #1}}; %
%    \end{tikzpicture}%
%  \end{center}
%}